package com.raodjava.demo4;

import java.util.HashSet;

public class Test2 {
    public static void main(String[] args) {
        UserInfo1 userInfo1_1 = new UserInfo1(1L, "张三", "123456");
        UserInfo1 userInfo1_2 = new UserInfo1(1L, "张三", "123456");

        HashSet<UserInfo1> set1 = new HashSet<>();
        set1.add(userInfo1_1);
        set1.add(userInfo1_2);
        System.out.println(set1.size()); // 2

        UserInfo2 userInfo2_1 = new UserInfo2(1L, "张三", "123456");
        UserInfo2 userInfo2_2 = new UserInfo2(1L, "李四", "123456");

        HashSet<UserInfo2> set2 = new HashSet<>();
        set2.add(userInfo2_1);
        set2.add(userInfo2_2);
        System.out.println(set2.size()); // 2

        UserInfo3 userInfo3_1 = new UserInfo3(1L, "张三", "123456");
        UserInfo3 userInfo3_2 = new UserInfo3(1L, "李四", "123456");

        HashSet<UserInfo3> set3 = new HashSet<>();
        set3.add(userInfo3_1);
        set3.add(userInfo3_2);
        System.out.println(set3.size()); // 1
    }
}
